<template>
    <h1> Vite + Vue3 + TS </h1>
    <h2>{{ msg }}</h2>
    <button @click="msg = 'Hi'"> Hi </button>
    <button @click="sayFn"> 打个招呼 </button>
  </template>
  
  <script lang="ts">
  import { defineComponent, ref } from 'vue';
  
  // ts 项目需要用 defineComponent 包起来
  export default defineComponent({
    setup() {
      const msg = ref('Hello');
  
      const sayFn = () => msg.value = '你好啊'
      
      return { msg,sayFn };
    },
  });
  </script>
  